<?php
session_start();
if(empty($_SESSION['username'])){
    header('Location: http://' . $_SERVER['HTTP_HOST'] . '/helloworld/login.php');
    exit;
}

include 'connectdb.php';
$id = $_GET["id"];
$mer_id = $_GET["mer_id"];
$sql ="SELECT * FROM tbl_item WHERE item_id =$id";
$result = mysql_db_query($dbname,$sql);
while($rs=mysql_fetch_array($result)) {
  $item_name = $rs["item_name"];
  $price = $rs["price"];
  $item_id = $rs["item_id"];
}
?>
<form action="admin_detail.php?edit_item=true" method="POST">
  <input type="hidden" name="mer_id" value="<?php echo htmlentities($mer_id); ?>"></input>
<input type="hidden" name="id" value="<?php echo htmlentities($item_id); ?>"></input>
  <table >
    <tr>
      <td colspan="2"><b>Edit Merchant</b></td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>Name</td>
      <td><input type="text" value="<?php echo htmlentities($item_name); ?>" name="name"></input></td>
    </tr>
    <tr>
      <td>Price</td>
      <td><input type="text" value="<?php echo htmlentities($price); ?>" name="price"></input></td>
    </tr>

    <tr>
      <td colspan="2"><center><input type="submit"></a></center></td>
    </tr>
  </table>
</form>
<a href="logout.php">Logout</a>
